const glob = require('glob');
const path = require('path');
const htmlWebpackPluginArray = [];
const entries = {};
glob.sync('./src/pages/**/**.js').forEach(paths => {
  const chunk = paths.split('./src/pages/')[1].split('/')[0]

  entries[chunk] = paths;
  const filename = chunk + '.html';

  let chunkName = './src/pages/' + chunk
  const htmlConf = {
    filename: filename,
    template: 'html-withimg-loader!' + path.resolve(chunkName, filename)
  };
  console.log(htmlConf)
  // htmlWebpackPluginArray.push(new HtmlWebpackPlugin(htmlConf));
});